﻿/*
 * Сделано в SharpDevelop.
 * Пользователь: maxxadm
 * Дата: 23.04.2012
 * Время: 14:33
 * 
 * Для изменения этого шаблона используйте Сервис | Настройка | Кодирование | Правка стандартных заголовков.
 */
using System;
using System.Windows;
using jellybird.core;
//using System.Windows.Forms;

namespace jellybird
{
	/// <summary>
	/// Class with program entry point.
	/// </summary>
	public sealed class Program
	{
		/// <summary>
		/// Program entry point.
		/// </summary>
		[STAThread]
		private static void Main(string[] args)
		{
			/*
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			main_form=new MainForm();
			*/
			
			/*
			jellybird.core.Helper.DebugMessage+=
				(sender,e)=>
				main_form.AppendLogText(sender,e);
			*/
			
			/*
			Application.Run(main_form);
			*/
			
			
			
			m_JellybirdApplication=new JellybirdApplication();
			m_JellybirdApplication.InitializeComponent();
			m_JellybirdApplication.Exit+= new ExitEventHandler(application_Exit);
			
			MainWindow main_window=new MainWindow();
			m_JellybirdApplication.Run(main_window);
			
			#if DEBUG
//			application.DebugMessage(null,new jellybird.core.MessageEventArg("Application runs"));
			#endif
			
			
		}

		static void application_Exit(object sender, ExitEventArgs e)
		{
			AccountManager.Save();
			app.Default.Save();
		}
		
		/*
		internal static MainWindow MainWindow
		{
			get{return main_window;}
		}
		private static MainWindow main_window;
		*/
		
		internal static JellybirdApplication JellybirdApplication
		{
			get{return m_JellybirdApplication;}
		}
		private static JellybirdApplication m_JellybirdApplication;
		
		public static AccountManager AccountManager
		{
			get
			{
				return AccountManager.Instance;
			}
		}
	}
}
